package com.yexuejc.dubbo.client.web;

import com.alibaba.dubbo.config.annotation.Reference;
import com.yexuejc.dubbo.api.TestSrv;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author maxf
 * @PackageName com.yexuejc.dubbo.client
 * @Description
 * @date 2018/9/26 11:30
 */
@RestController
public class IndexCtrl {

    @Reference(version = "${demo.service.version}",
            application = "${dubbo.application.id}",
            url = "dubbo://localhost:12345")
    TestSrv testSrv;

    @RequestMapping("/")
    public String index(String name) {
        if (StringUtils.isEmpty(name)) {
            name = "zhangsan";
        }
        return testSrv.hello(name);
    }
}
